/**
 * @Author: Lenovo
 * @Date: 2024/11/8 23:19
 * @description:
 */
public class Demo10 {
    public static boolean isFinshed = false;
    public static void main(String[] args) throws InterruptedException {
    //    boolean isFinshed = false;
        Thread t = new Thread(() -> {
            while (!isFinshed){
                System.out.println("Hello Thread!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        t.start();
        Thread.sleep(3000);
        isFinshed = true;
    }
}
